<?php

class cTimer {
	public $_start, $_stop;

	public function __construct() {
		$_start = array();
		$_stop = array();
	}

	public function start($name = "default") {
		$this->_start[$name] = time();
	}

	public function set_start($name = "default", $value) {
		$this->_start[$name] = $value;
	}

	public function set_stop($name = "default", $value) {
		$this->_stop[$name] = $value;
	}

	public function stop($name = "default") {
		$this->_stop[$name] = time();
	}

	public function get($name = "default") {
		return ($this->_stop[$name] - $this->_start[$name]);
	}

	public function show($name = "default") {
		$per = $this->get($name);
		$min = round($per / 60);
		$sec = round($per % 60);
		$h = round($min / 60);
		$m = round($min % 60);

		return "$h h $m m $sec s";
	}
}

?>
